<?php

class Add_Setup_Account_Show_Adapter
{
    private $_adapter;

    public function __construct($userId)
    {
        if(!isset($this->_adapter))
        {
            $front = Zend_Controller_Front::getInstance();
            $bootstrap = $front->getParam('bootstrap');
            $options = $bootstrap->getApplication()->getOptions();

            $classname = "Add_Setup_Account_Show_Adapter_".ucfirst($options['auth']['adapter']['base']);
            if(!class_exists( $classname ))
            {
                require_once 'Add/Setup/Account/Show/Exception.php';
                throw new Add_Setup_Account_Show_Exception("Setup account adapter '".$options['auth']['adapter']['base']."' is not exists.");
            }
            
            $this->_adapter = new $classname($userId);
        }
    }
    
    public function buildAccountForm()
    {
        return $this->_adapter->buildAccountForm();
    }
}
